{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Imports\n",
    "\n",
    "Import all the modules and functionalities we need."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "# Import standard libraries.\n",
    "import os\n",
    "\n",
    "# Import third party libraries.\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "from statsmodels.stats.multitest import multipletests\n",
    "\n",
    "# Import custom libraries/scripts.\n",
    "import annotations\n",
    "import helpers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Loading data\n",
    "\n",
    "Fetch all our relevant data for the current analysis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set working contants.\n",
    "EXPERIMENTS_PATHS = [r'\\\\10.40.12.80\\home\\PhD\\Results\\Competition\\DL\\small_arenas\\WT_mating_pairs\\processed',\n",
    "                     r'\\\\10.40.12.80\\home\\PhD\\Results\\Competition\\DL\\small_arenas\\two_females_only\\processed'\n",
    "                    ]\n",
    "FPS = 60\n",
    "N_MINUTES = 60\n",
    "N_FRAMES = N_MINUTES * 60 * FPS\n",
    "INK = 'black'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set figure configurations.\n",
    "sns.set(\n",
    "        context='paper',\n",
    "        style='ticks',\n",
    "        font='sans-serif',\n",
    "        font_scale=1.0, \n",
    "        rc={\n",
    "            'axes.axisbelow': True,\n",
    "            'axes.edgecolor': INK,\n",
    "            'axes.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'axes.grid': False,\n",
    "            'axes.labelcolor': INK,\n",
    "            'axes.labelsize': 13.0,\n",
    "            'axes.labelweight': 'normal',\n",
    "            'axes.linewidth': 1.0,\n",
    "            'axes.spines.left': True,\n",
    "            'axes.spines.bottom': True,\n",
    "            'axes.spines.top': False,\n",
    "            'axes.spines.right': False,\n",
    "            'axes.titlepad': 15.0,\n",
    "            'axes.titlesize': 20.0,\n",
    "            'axes.titleweight': 'bold',\n",
    "            'figure.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'figure.figsize': [6.0, 4.0],\n",
    "            'figure.titlesize': 30.0,\n",
    "            'figure.titleweight': 'bold',\n",
    "            'font.family': ['sans-serif'],\n",
    "            'font.sans-serif': ['Arial'],\n",
    "            'legend.frameon': False,\n",
    "            'legend.fontsize': 11.0,\n",
    "            'lines.color': INK,\n",
    "            'lines.linewidth': 1.0,\n",
    "            'patch.edgecolor': INK,\n",
    "            'savefig.dpi': 300,\n",
    "            'savefig.format': 'png',\n",
    "            'savefig.bbox': 'tight',\n",
    "            'savefig.transparent': True,\n",
    "            'text.color': INK,\n",
    "            'text.usetex': False,\n",
    "            'xtick.color': INK,\n",
    "            'xtick.direction': 'out',\n",
    "            'xtick.labelsize': 12.0,\n",
    "            'xtick.major.pad': 5.0,\n",
    "            'xtick.major.size': 0.0,\n",
    "            'xtick.major.width': 1.0,\n",
    "            'xtick.minor.size': 0.0,\n",
    "            'xtick.minor.width': 0.4,\n",
    "            'ytick.color': INK,\n",
    "            'ytick.direction': 'out',\n",
    "            'ytick.labelsize': 12.0,\n",
    "            'ytick.major.pad': 5.0,\n",
    "            'ytick.major.size': 3.0,\n",
    "            'ytick.major.width': 1.0,\n",
    "            'ytick.minor.size': 0.0,\n",
    "            'ytick.minor.width': 0.4\n",
    "           }\n",
    "       )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Folder already exists, skipping.\n"
     ]
    }
   ],
   "source": [
    "# Prepare the Figures folder to save our graphs in.\n",
    "savepath = os.path.join(r'C:\\Users\\Miguel\\Desktop\\paper_data', 'paper_figures', 'figure4')\n",
    "try:\n",
    "    os.makedirs(savepath)\n",
    "    print('New folder created.')\n",
    "except FileExistsError:\n",
    "    print('Folder already exists, skipping.')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Paths to conditions:\n",
      " ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food', '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food', '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food', '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food']\n"
     ]
    }
   ],
   "source": [
    "# Set the conditions to analyze.\n",
    "condition_order = ['food', 'no_food']\n",
    "conditions = []\n",
    "for PATH in EXPERIMENTS_PATHS:\n",
    "    conditions.append([item.path for item in os.scandir(PATH) if item.name in condition_order])\n",
    "\n",
    "conditions = list(np.concatenate(conditions).flat)\n",
    "print('Paths to conditions:\\n', conditions)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t\n",
      " food\n",
      "\t\n",
      " no_food\n",
      "\t\n",
      " food\n",
      "\t\n",
      " no_food\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'food_mating_pairs': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-06T10_32_06_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-06T10_32_06_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-06T10_32_06_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-06T10_32_06_arena8.csv'],\n",
       " 'no_food_mating_pairs': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T11_29_29_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T11_29_29_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T11_29_29_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T11_29_29_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T11_29_29_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-06T10_32_06_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-06T10_32_06_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-06T10_32_06_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-06T10_32_06_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-06T10_32_06_arena16.csv'],\n",
       " 'food_females': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T11_37_33_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T11_37_33_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T11_37_33_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T11_37_33_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T11_37_33_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T11_37_33_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T11_37_33_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena9.csv'],\n",
       " 'no_food_females': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena8.csv']}"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Load all usable experiments for each condition.\n",
    "experiments = {'food_mating_pairs': [],\n",
    "               'no_food_mating_pairs': [],\n",
    "               'food_females': [],\n",
    "               'no_food_females': []\n",
    "              }\n",
    "\n",
    "for condition_path in conditions:\n",
    "\n",
    "    condition = os.path.basename(condition_path)\n",
    "    print('\\t\\n', condition)\n",
    "\n",
    "    for item in os.scandir(condition_path):\n",
    "        if item.name.endswith('.csv'):\n",
    "            \n",
    "            annotation_video = annotations.read(item.path)\n",
    "            \n",
    "            if 'WT' in item.path:\n",
    "            \n",
    "                try:\n",
    "                    copulation = annotation_video[0].events[0]\n",
    "\n",
    "                    # Filter out videos where copulation is interrupted.\n",
    "                    copulation_end = copulation.time_interval[1]\n",
    "                    if copulation_end==N_FRAMES:\n",
    "                        print('Copulation interrupted:', item.name)\n",
    "                        continue\n",
    "\n",
    "                    # Filter out videos where copulation lasts less than 8 minutes.\n",
    "                    copulation_duration = copulation.duration\n",
    "                    if copulation_duration <= 8 * 60 * FPS:\n",
    "                        print('Copulation too short:', item.name)\n",
    "                        continue\n",
    "\n",
    "                except IndexError:\n",
    "                    continue\n",
    "\n",
    "                experiments[condition + '_mating_pairs'].append(item.path)\n",
    "                \n",
    "            else:\n",
    "                \n",
    "                experiments[condition + '_females'].append(item.path)\n",
    "\n",
    "experiments"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Aggression Analysis (First 5 Minutes ONLY)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iteration: 0 \n",
      "Experiment: video_2019-11-27T10_50_09_arena1.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2019-11-27T10_50_09_arena10.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2019-11-27T10_50_09_arena11.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2019-11-27T10_50_09_arena12.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2019-11-27T10_50_09_arena13.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2019-11-27T10_50_09_arena14.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2019-11-27T10_50_09_arena15.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2019-11-27T10_50_09_arena2.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2019-11-27T10_50_09_arena3.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2019-11-27T10_50_09_arena4.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2019-11-27T10_50_09_arena5.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2019-11-27T10_50_09_arena6.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2019-11-27T10_50_09_arena7.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2019-11-27T10_50_09_arena8.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2019-11-27T10_50_09_arena9.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2019-12-05T11_29_29_arena10.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2019-12-05T11_29_29_arena11.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2019-12-05T11_29_29_arena12.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2019-12-05T11_29_29_arena13.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2019-12-05T11_29_29_arena14.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2019-12-05T11_29_29_arena15.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2019-12-05T11_29_29_arena16.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2019-12-05T11_29_29_arena9.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2019-12-06T10_32_06_arena2.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2019-12-06T10_32_06_arena3.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2019-12-06T10_32_06_arena7.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2019-12-06T10_32_06_arena8.csv \n",
      "Condition: food_mating_pairs \n",
      "\n",
      "Iteration: 0 \n",
      "Experiment: video_2019-12-05T10_28_30_arena10.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2019-12-05T10_28_30_arena11.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2019-12-05T10_28_30_arena12.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2019-12-05T10_28_30_arena13.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2019-12-05T10_28_30_arena14.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2019-12-05T10_28_30_arena16.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2019-12-05T10_28_30_arena2.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2019-12-05T10_28_30_arena3.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2019-12-05T10_28_30_arena4.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2019-12-05T10_28_30_arena5.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2019-12-05T10_28_30_arena7.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2019-12-05T10_28_30_arena8.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2019-12-05T10_28_30_arena9.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2019-12-05T11_29_29_arena1.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2019-12-05T11_29_29_arena2.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2019-12-05T11_29_29_arena5.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2019-12-05T11_29_29_arena7.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2019-12-05T11_29_29_arena8.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2019-12-06T10_32_06_arena10.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2019-12-06T10_32_06_arena11.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2019-12-06T10_32_06_arena12.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2019-12-06T10_32_06_arena13.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2019-12-06T10_32_06_arena16.csv \n",
      "Condition: no_food_mating_pairs \n",
      "\n",
      "Iteration: 0 \n",
      "Experiment: video_2019-12-12T10_41_16_arena11.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2019-12-12T10_41_16_arena12.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2019-12-12T10_41_16_arena15.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2019-12-12T10_41_16_arena16.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2019-12-12T10_41_16_arena3.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2019-12-12T10_41_16_arena4.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2019-12-12T10_41_16_arena7.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2019-12-12T10_41_16_arena8.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2019-12-12T11_37_33_arena10.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2019-12-12T11_37_33_arena13.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2019-12-12T11_37_33_arena14.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2019-12-12T11_37_33_arena2.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2019-12-12T11_37_33_arena5.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2019-12-12T11_37_33_arena6.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2019-12-12T11_37_33_arena9.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2019-12-18T10_01_30_arena10.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2019-12-18T10_01_30_arena11.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2019-12-18T10_01_30_arena12.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2019-12-18T10_01_30_arena13.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2019-12-18T10_01_30_arena14.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2019-12-18T10_01_30_arena15.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2019-12-18T10_01_30_arena16.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2019-12-18T10_01_30_arena9.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2019-12-18T10_57_35_arena1.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2019-12-18T10_57_35_arena2.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2019-12-18T10_57_35_arena3.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2019-12-18T10_57_35_arena4.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 27 \n",
      "Experiment: video_2019-12-18T10_57_35_arena5.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 28 \n",
      "Experiment: video_2019-12-18T10_57_35_arena6.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 29 \n",
      "Experiment: video_2019-12-18T10_57_35_arena7.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 30 \n",
      "Experiment: video_2019-12-18T10_57_35_arena8.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 31 \n",
      "Experiment: video_2019-12-18T11_55_14_arena1.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 32 \n",
      "Experiment: video_2019-12-18T11_55_14_arena10.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 33 \n",
      "Experiment: video_2019-12-18T11_55_14_arena13.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 34 \n",
      "Experiment: video_2019-12-18T11_55_14_arena14.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 35 \n",
      "Experiment: video_2019-12-18T11_55_14_arena2.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 36 \n",
      "Experiment: video_2019-12-18T11_55_14_arena5.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 37 \n",
      "Experiment: video_2019-12-18T11_55_14_arena6.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 38 \n",
      "Experiment: video_2019-12-18T11_55_14_arena9.csv \n",
      "Condition: food_females \n",
      "\n",
      "Iteration: 0 \n",
      "Experiment: video_2019-12-12T10_41_16_arena1.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2019-12-12T10_41_16_arena10.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2019-12-12T10_41_16_arena13.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2019-12-12T10_41_16_arena14.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2019-12-12T10_41_16_arena2.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2019-12-12T10_41_16_arena5.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2019-12-12T10_41_16_arena6.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2019-12-12T10_41_16_arena9.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2019-12-12T11_37_33_arena11.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2019-12-12T11_37_33_arena12.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2019-12-12T11_37_33_arena15.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2019-12-12T11_37_33_arena16.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2019-12-12T11_37_33_arena3.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2019-12-12T11_37_33_arena4.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2019-12-12T11_37_33_arena7.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2019-12-12T11_37_33_arena8.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2019-12-18T10_01_30_arena1.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2019-12-18T10_01_30_arena2.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2019-12-18T10_01_30_arena3.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2019-12-18T10_01_30_arena4.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2019-12-18T10_01_30_arena5.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2019-12-18T10_01_30_arena6.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2019-12-18T10_01_30_arena7.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2019-12-18T10_01_30_arena8.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2019-12-18T10_57_35_arena10.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2019-12-18T10_57_35_arena11.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2019-12-18T10_57_35_arena12.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 27 \n",
      "Experiment: video_2019-12-18T10_57_35_arena13.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 28 \n",
      "Experiment: video_2019-12-18T10_57_35_arena14.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 29 \n",
      "Experiment: video_2019-12-18T10_57_35_arena15.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 30 \n",
      "Experiment: video_2019-12-18T10_57_35_arena16.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 31 \n",
      "Experiment: video_2019-12-18T10_57_35_arena9.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 32 \n",
      "Experiment: video_2019-12-18T11_55_14_arena11.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 33 \n",
      "Experiment: video_2019-12-18T11_55_14_arena12.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 34 \n",
      "Experiment: video_2019-12-18T11_55_14_arena15.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 35 \n",
      "Experiment: video_2019-12-18T11_55_14_arena16.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 36 \n",
      "Experiment: video_2019-12-18T11_55_14_arena3.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 37 \n",
      "Experiment: video_2019-12-18T11_55_14_arena4.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 38 \n",
      "Experiment: video_2019-12-18T11_55_14_arena7.csv \n",
      "Condition: no_food_females \n",
      "\n",
      "Iteration: 39 \n",
      "Experiment: video_2019-12-18T11_55_14_arena8.csv \n",
      "Condition: no_food_females \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>has_food</th>\n",
       "      <th>aggression_latency</th>\n",
       "      <th>aggression_latency_mins</th>\n",
       "      <th>nframes</th>\n",
       "      <th>nbouts</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>1771.0</td>\n",
       "      <td>0.491944</td>\n",
       "      <td>504</td>\n",
       "      <td>5</td>\n",
       "      <td>0.028000</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food_mating_pairs</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2032.0</td>\n",
       "      <td>0.564444</td>\n",
       "      <td>2112</td>\n",
       "      <td>13</td>\n",
       "      <td>0.117333</td>\n",
       "      <td>2.6</td>\n",
       "      <td>food_mating_pairs</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5507.0</td>\n",
       "      <td>1.529722</td>\n",
       "      <td>1340</td>\n",
       "      <td>11</td>\n",
       "      <td>0.074444</td>\n",
       "      <td>2.2</td>\n",
       "      <td>food_mating_pairs</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>7035.0</td>\n",
       "      <td>1.954167</td>\n",
       "      <td>1784</td>\n",
       "      <td>8</td>\n",
       "      <td>0.099111</td>\n",
       "      <td>1.6</td>\n",
       "      <td>food_mating_pairs</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5045.0</td>\n",
       "      <td>1.401389</td>\n",
       "      <td>3045</td>\n",
       "      <td>7</td>\n",
       "      <td>0.169167</td>\n",
       "      <td>1.4</td>\n",
       "      <td>food_mating_pairs</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>124</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food_females</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>125</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food_females</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>126</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food_females</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>127</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food_females</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>128</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>-16636.0</td>\n",
       "      <td>-4.621111</td>\n",
       "      <td>37</td>\n",
       "      <td>4</td>\n",
       "      <td>0.002056</td>\n",
       "      <td>0.8</td>\n",
       "      <td>no_food_females</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena8.csv</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>129 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     has_aggression  has_food  aggression_latency  aggression_latency_mins  \\\n",
       "0              True      True              1771.0                 0.491944   \n",
       "1              True      True              2032.0                 0.564444   \n",
       "2              True      True              5507.0                 1.529722   \n",
       "3              True      True              7035.0                 1.954167   \n",
       "4              True      True              5045.0                 1.401389   \n",
       "..              ...       ...                 ...                      ...   \n",
       "124           False     False                 NaN                 0.000000   \n",
       "125           False     False                 NaN                 0.000000   \n",
       "126           False     False                 NaN                 0.000000   \n",
       "127           False     False                 NaN                 0.000000   \n",
       "128            True     False            -16636.0                -4.621111   \n",
       "\n",
       "     nframes  nbouts  ratio_frames  ratio_bouts          condition  \\\n",
       "0        504       5      0.028000          1.0  food_mating_pairs   \n",
       "1       2112      13      0.117333          2.6  food_mating_pairs   \n",
       "2       1340      11      0.074444          2.2  food_mating_pairs   \n",
       "3       1784       8      0.099111          1.6  food_mating_pairs   \n",
       "4       3045       7      0.169167          1.4  food_mating_pairs   \n",
       "..       ...     ...           ...          ...                ...   \n",
       "124        0       0      0.000000          0.0    no_food_females   \n",
       "125        0       0      0.000000          0.0    no_food_females   \n",
       "126        0       0      0.000000          0.0    no_food_females   \n",
       "127        0       0      0.000000          0.0    no_food_females   \n",
       "128       37       4      0.002056          0.8    no_food_females   \n",
       "\n",
       "                                experiment  \n",
       "0     video_2019-11-27T10_50_09_arena1.csv  \n",
       "1    video_2019-11-27T10_50_09_arena10.csv  \n",
       "2    video_2019-11-27T10_50_09_arena11.csv  \n",
       "3    video_2019-11-27T10_50_09_arena12.csv  \n",
       "4    video_2019-11-27T10_50_09_arena13.csv  \n",
       "..                                     ...  \n",
       "124  video_2019-12-18T11_55_14_arena16.csv  \n",
       "125   video_2019-12-18T11_55_14_arena3.csv  \n",
       "126   video_2019-12-18T11_55_14_arena4.csv  \n",
       "127   video_2019-12-18T11_55_14_arena7.csv  \n",
       "128   video_2019-12-18T11_55_14_arena8.csv  \n",
       "\n",
       "[129 rows x 10 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "aggression_df = pd.DataFrame()\n",
    "for condition in experiments.keys():\n",
    "    for h, experiment_path in enumerate(experiments[condition]):\n",
    "\n",
    "        experiment = os.path.basename(experiment_path)\n",
    "        \n",
    "        print('Iteration:', h, '\\nExperiment:', experiment, '\\nCondition:', condition, '\\n')\n",
    "        \n",
    "        # Exclude experiments without copulation (since aggression is only observed during copulation).\n",
    "        annotation_video = annotations.read(experiment_path)\n",
    "        \n",
    "        if 'WT' in experiment_path:\n",
    "            try:\n",
    "                copulation = annotation_video[0].events[0]\n",
    "            except IndexError:\n",
    "                continue\n",
    "            # Consider aggression only during the first 5 minutes of copulation.\n",
    "            aggression_events = list(filter(lambda event: event.time < (copulation.time + 18000), annotation_video[1].events))\n",
    "        else:\n",
    "            try:\n",
    "                arena_start = annotation_video[0].events[0].time\n",
    "            except IndexError:\n",
    "                continue\n",
    "            # Get aggression only from minute 5 to minute 10.\n",
    "            aggression_events = []\n",
    "            for event in annotation_video[1].events:\n",
    "                if (event.time >= (arena_start + 5 * 60 * FPS) and event.time < (arena_start + 10 * 60 * FPS)):\n",
    "                    aggression_events.append(event)\n",
    "\n",
    "        n_events = len(aggression_events)\n",
    "\n",
    "        # In case there is aggression, do the necessary calculations.\n",
    "        if n_events > 0:\n",
    "            \n",
    "            aggression_latency =  aggression_events[0].time - copulation.time\n",
    "            aggression_latency_mins = aggression_latency / (60 * FPS)\n",
    "            \n",
    "            ratio_frames = sum([aggression.duration for aggression in aggression_events]) / (5 * 60 * FPS)\n",
    "            ratio_bouts = n_events / 5\n",
    "            \n",
    "            aggression_data = pd.DataFrame({'has_aggression': True,\n",
    "                                            'has_food': False if 'no_food' in condition else True,\n",
    "                                            'aggression_latency': aggression_latency,\n",
    "                                            'aggression_latency_mins': aggression_latency_mins,\n",
    "                                            'nframes': sum([aggression.duration for aggression in aggression_events]),\n",
    "                                            'nbouts': n_events,\n",
    "                                            'ratio_frames': ratio_frames,\n",
    "                                            'ratio_bouts': ratio_bouts,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        # If not, preset our dictionary with default values.\n",
    "        else:\n",
    "            aggression_data = pd.DataFrame({'has_aggression': False,\n",
    "                                            'has_food': False if 'no_food' in condition else True,\n",
    "                                            'aggression_latency': np.nan,\n",
    "                                            'aggression_latency_mins': 0,\n",
    "                                            'nframes': 0,\n",
    "                                            'nbouts': 0,\n",
    "                                            'ratio_frames': 0, \n",
    "                                            'ratio_bouts': 0,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        # Concatenate all data together.\n",
    "        aggression_df = pd.concat([aggression_df, aggression_data], ignore_index=True)\n",
    "\n",
    "aggression_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Outlier Detection"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t food_mating_pairs \n",
      "\n",
      "[]\n",
      "Number data points considered outliers: 0\n",
      "Percent data points considered outliers: 0.0 %\n",
      "\n",
      "\t no_food_mating_pairs \n",
      "\n",
      "[]\n",
      "Number data points considered outliers: 0\n",
      "Percent data points considered outliers: 0.0 %\n",
      "\n",
      "\t food_females \n",
      "\n",
      "[60, 66]\n",
      "Number data points considered outliers: 2\n",
      "Percent data points considered outliers: 5.128 %\n",
      "\n",
      "\t no_food_females \n",
      "\n",
      "[97]\n",
      "Number data points considered outliers: 1\n",
      "Percent data points considered outliers: 2.5 %\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>has_food</th>\n",
       "      <th>aggression_latency</th>\n",
       "      <th>aggression_latency_mins</th>\n",
       "      <th>nframes</th>\n",
       "      <th>nbouts</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>1771.0</td>\n",
       "      <td>0.491944</td>\n",
       "      <td>504</td>\n",
       "      <td>5</td>\n",
       "      <td>0.028000</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food_mating_pairs</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2032.0</td>\n",
       "      <td>0.564444</td>\n",
       "      <td>2112</td>\n",
       "      <td>13</td>\n",
       "      <td>0.117333</td>\n",
       "      <td>2.6</td>\n",
       "      <td>food_mating_pairs</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5507.0</td>\n",
       "      <td>1.529722</td>\n",
       "      <td>1340</td>\n",
       "      <td>11</td>\n",
       "      <td>0.074444</td>\n",
       "      <td>2.2</td>\n",
       "      <td>food_mating_pairs</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>7035.0</td>\n",
       "      <td>1.954167</td>\n",
       "      <td>1784</td>\n",
       "      <td>8</td>\n",
       "      <td>0.099111</td>\n",
       "      <td>1.6</td>\n",
       "      <td>food_mating_pairs</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5045.0</td>\n",
       "      <td>1.401389</td>\n",
       "      <td>3045</td>\n",
       "      <td>7</td>\n",
       "      <td>0.169167</td>\n",
       "      <td>1.4</td>\n",
       "      <td>food_mating_pairs</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>124</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food_females</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>125</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food_females</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>126</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food_females</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>127</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food_females</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>128</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>-16636.0</td>\n",
       "      <td>-4.621111</td>\n",
       "      <td>37</td>\n",
       "      <td>4</td>\n",
       "      <td>0.002056</td>\n",
       "      <td>0.8</td>\n",
       "      <td>no_food_females</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena8.csv</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>126 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     has_aggression  has_food  aggression_latency  aggression_latency_mins  \\\n",
       "0              True      True              1771.0                 0.491944   \n",
       "1              True      True              2032.0                 0.564444   \n",
       "2              True      True              5507.0                 1.529722   \n",
       "3              True      True              7035.0                 1.954167   \n",
       "4              True      True              5045.0                 1.401389   \n",
       "..              ...       ...                 ...                      ...   \n",
       "124           False     False                 NaN                 0.000000   \n",
       "125           False     False                 NaN                 0.000000   \n",
       "126           False     False                 NaN                 0.000000   \n",
       "127           False     False                 NaN                 0.000000   \n",
       "128            True     False            -16636.0                -4.621111   \n",
       "\n",
       "     nframes  nbouts  ratio_frames  ratio_bouts          condition  \\\n",
       "0        504       5      0.028000          1.0  food_mating_pairs   \n",
       "1       2112      13      0.117333          2.6  food_mating_pairs   \n",
       "2       1340      11      0.074444          2.2  food_mating_pairs   \n",
       "3       1784       8      0.099111          1.6  food_mating_pairs   \n",
       "4       3045       7      0.169167          1.4  food_mating_pairs   \n",
       "..       ...     ...           ...          ...                ...   \n",
       "124        0       0      0.000000          0.0    no_food_females   \n",
       "125        0       0      0.000000          0.0    no_food_females   \n",
       "126        0       0      0.000000          0.0    no_food_females   \n",
       "127        0       0      0.000000          0.0    no_food_females   \n",
       "128       37       4      0.002056          0.8    no_food_females   \n",
       "\n",
       "                                experiment  \n",
       "0     video_2019-11-27T10_50_09_arena1.csv  \n",
       "1    video_2019-11-27T10_50_09_arena10.csv  \n",
       "2    video_2019-11-27T10_50_09_arena11.csv  \n",
       "3    video_2019-11-27T10_50_09_arena12.csv  \n",
       "4    video_2019-11-27T10_50_09_arena13.csv  \n",
       "..                                     ...  \n",
       "124  video_2019-12-18T11_55_14_arena16.csv  \n",
       "125   video_2019-12-18T11_55_14_arena3.csv  \n",
       "126   video_2019-12-18T11_55_14_arena4.csv  \n",
       "127   video_2019-12-18T11_55_14_arena7.csv  \n",
       "128   video_2019-12-18T11_55_14_arena8.csv  \n",
       "\n",
       "[126 rows x 10 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "corrected_ratio_frames = pd.DataFrame()\n",
    "\n",
    "for condition in experiments.keys():\n",
    "\n",
    "    print('\\n\\t', condition, '\\n')\n",
    "\n",
    "    try:\n",
    "        dataset = aggression_df.query('condition==\"' + condition + '\"')['ratio_frames']\n",
    "\n",
    "        outlier_positions = helpers.check_outliers(dataset)\n",
    "        print(outlier_positions)\n",
    "\n",
    "        fresh_dataset = pd.DataFrame(helpers.remove_outliers(dataset, indices=outlier_positions))\n",
    "        fresh_dataset['condition'] = condition\n",
    "\n",
    "        corrected_ratio_frames = pd.concat([corrected_ratio_frames, fresh_dataset], axis=0)\n",
    "        \n",
    "    except ValueError as error:\n",
    "        print(error)\n",
    "\n",
    "aggression_df = aggression_df.loc[corrected_ratio_frames.index]\n",
    "aggression_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Aggression Rate"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>condition</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>has_food</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>food_mating_pairs</td>\n",
       "      <td>0.028000</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>food_mating_pairs</td>\n",
       "      <td>0.117333</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>food_mating_pairs</td>\n",
       "      <td>0.074444</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>food_mating_pairs</td>\n",
       "      <td>0.099111</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>food_mating_pairs</td>\n",
       "      <td>0.169167</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           condition  ratio_frames  has_food\n",
       "0  food_mating_pairs      0.028000      True\n",
       "1  food_mating_pairs      0.117333      True\n",
       "2  food_mating_pairs      0.074444      True\n",
       "3  food_mating_pairs      0.099111      True\n",
       "4  food_mating_pairs      0.169167      True"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_frames_df = aggression_df.copy()[['condition', 'ratio_frames', 'has_food']]\n",
    "ratio_frames_df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t no_food_mating_pairs \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS NOT normally distributed.\n",
      "Shapiro's Test: group 2 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 2 IS NOT normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.000002\n",
      "  All groups were sampled from populations with NOT IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 2.9407320690933132e-08 \n",
      "\n",
      "\n",
      "\t food_females \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS NOT normally distributed.\n",
      "Shapiro's Test: group 2 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 2 IS NOT normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.000000\n",
      "  All groups were sampled from populations with NOT IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 1.6794765443468987e-08 \n",
      "\n",
      "\n",
      "\t no_food_females \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS NOT normally distributed.\n",
      "Shapiro's Test: group 2 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 2 IS NOT normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.000000\n",
      "  All groups were sampled from populations with NOT IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 7.655302061524569e-09 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'no_food_mating_pairs': 2.9407320690933132e-08,\n",
       " 'food_females': 1.6794765443468987e-08,\n",
       " 'no_food_females': 7.655302061524569e-09}"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_frames_pvalues = {}\n",
    "\n",
    "control = ratio_frames_df.query('condition==\"food_mating_pairs\"')['ratio_frames']\n",
    "\n",
    "for condition in list(experiments.keys())[1:]:\n",
    "\n",
    "    print('\\n\\t', condition, '\\n')\n",
    "\n",
    "    try:\n",
    "        test = ratio_frames_df.query('condition==\"' + condition + '\"')['ratio_frames']\n",
    "\n",
    "        temp_values = {'control': control, 'test': test}\n",
    "\n",
    "        pvalue_condition = helpers.run_statistics(temp_values)\n",
    "\n",
    "        ratio_frames_pvalues[condition] = pvalue_condition\n",
    "        \n",
    "    except ValueError as error:\n",
    "        print(error)\n",
    "    \n",
    "ratio_frames_pvalues"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Bonferroni Correction\n",
      "---------------------\n",
      "\n",
      "\tOriginal Values:\n",
      " {'no_food_mating_pairs': 2.9407320690933132e-08, 'food_females': 1.6794765443468987e-08, 'no_food_females': 7.655302061524569e-09}\n",
      "\n",
      "\tCorrected Values:\n",
      " {'no_food_mating_pairs': 8.82219620727994e-08, 'food_females': 5.038429633040696e-08, 'no_food_females': 2.2965906184573705e-08} \n",
      "\n"
     ]
    }
   ],
   "source": [
    "# Bonferroni corretction for multiple comparisons.\n",
    "title = 'Bonferroni Correction'\n",
    "print(title)\n",
    "print('-'*len(title))\n",
    "\n",
    "# Show uncorrected values.\n",
    "print('\\n\\tOriginal Values:\\n', ratio_frames_pvalues)\n",
    "\n",
    "# Apply the bonferroni correction for multiple comparisons.\n",
    "frames_multi_comp_correction = multipletests(pvals=list(ratio_frames_pvalues.values()), alpha=0.05, method='bonferroni')[1]\n",
    "\n",
    "# Transform the correction results into a dictionary.\n",
    "corrected_frames_pvalues = dict(zip(list(ratio_frames_pvalues.keys()), frames_multi_comp_correction))\n",
    "\n",
    "# Show corrected values.\n",
    "print('\\n\\tCorrected Values:\\n', corrected_frames_pvalues, '\\n')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Effect Size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "no_food_mating_pairs\n",
      "Large Efect: -1.0 \n",
      "\n",
      "food_females\n",
      "Large Efect: -0.9719999999999999 \n",
      "\n",
      "no_food_females\n",
      "Large Efect: -0.9693333333333333 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'no_food_mating_pairs': -1.0,\n",
       " 'food_females': -0.9719999999999999,\n",
       " 'no_food_females': -0.9693333333333333}"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_frames_effect_sizes = {}\n",
    "\n",
    "control = ratio_frames_df.query('condition==\"food_mating_pairs\"')['ratio_frames']\n",
    "\n",
    "for condition in list(experiments.keys())[1:]:\n",
    "    \n",
    "    print(condition)\n",
    "    \n",
    "    test = ratio_frames_df.query('condition==\"' + condition +'\"')['ratio_frames']\n",
    "\n",
    "    median_diff = helpers.get_effect_size(control, test, method='median_diff')\n",
    "\n",
    "    ratio_frames_effect_sizes[condition] = median_diff\n",
    "    \n",
    "ratio_frames_effect_sizes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAFgCAYAAABUqmV5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nOzdeXwM9x/H8dceuU9CJESCxJWEuM+qW0vdUg1VV2m11WqVKq2zeqMHLVWl6ixaR1H31VJFiZsQIYmESOQ+95jfH+lvmiBamuymfJ6Px/4x392dfc9Y+8n3OzPf0SiKoiCEEEIAWmsHEEIIUXpIURBCCKGSoiCEEEIlRUEIIYRKioIQQgiVFAUhhBAqKQrFaOnSpYSEhFCvXj1atGjBkSNHMJlMvPrqq9SqVYuAgADmzZtn7ZhCCFEkvbUDPCjOnz/P2LFjOXr0KN7e3mzevJnevXvz5ptvEhERwalTp0hPT6d58+Y0aNCAJk2aWDuyEELcRnoKxcTOzo4FCxbg7e0NQKNGjbh27RqrV69myJAh6PV6ypQpQ1hYGEuXLrVyWiGEuDMpCsWkSpUqPPHEEwAoisLo0aPp3r078fHxVK5cWX2dj48PsbGxRa5nypQpaDQa9SGEEJYkRaGYZWZm0rdvXy5evMiCBQswm82FftwVRUGn0xX5/ilTpqAoCjL7iBDCGqQoFKPo6GhatGiBTqdj9+7duLu74+vrS1xcnPqauLg4fHx8rJhSCCGKJkWhmKSnp9OmTRt69+7NypUrcXBwAKBHjx4sXLgQo9FISkoKK1eupGfPnlZOK4QQdyZnHxWTOXPmcOXKFdauXcvatWvV9q1btxIZGUlISAh5eXk8//zztG7d2opJhRCiaBqZOrv00mg0cmxBCGFRMnwkhBBCJUVBCCGESoqCEEIIlRQFIYQQKikKQgghVFIUhBBCqKQoCCGEUElREEIIoZKiIIQQQiVFQYi7qFu37l2X76XtQSL75c4ehP0i01yUYjLNhfV8+OGH/Pbb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W7YEYPr06XzwwQdUVVXxwgsv4O7uDsC4ceOw2+0cO3aMsLAwAgICAEhISGDFihUPvKfw8PCGD0QjcXV1JTQ0tM6xgICAesf+jWpra6mtrTXKJpMJJyenRuxR49N8ubfmNl+a3fbRnwcXwOFwUFNTc8/jJpMJh8NhHHd2rp+DDT33XvWBOudUV1fXqefm5vZQ9yhN29KlS+tslXTt2rWxuyRNWHObL80uFGJjY40VQUFBAVlZWURERNQ5Xl5ezmeffUZ0dDSDBw/mo48+ora2losXL3LkyJG7XnP79u1UVVVRU1ODzWYjJiaGQYMGsWfPHm7cuMGtW7fYtWsX8Mcn/u+++8747iA1NZWYmBjgj1VKXl4eAJ9//vmTHg5pBAkJCRw/ftx47dmzp7G7JE1Yc5svTXb76F7Wrl1LQkICNpsNk8nEpk2b8PX15e2332bWrFkEBwdjt9tZuHAhffv2JTg4mNzcXHr16oW/vz9BQUH1rmm1WsnOziY0NJSamhqGDBlCUlISzs7OJCcn069fP9q0aYO/vz8A7du3JzU1ldGjR3P79m38/f2NQEpJSSEpKYmUlBSef/75v3VsnqQ/r5j+7fz8/LRH/gCaL/+vuc0Xk0PvnoiI/J9mt30kIiJPjkJBREQMCgURETEoFERExKBQEBERg0JBREQMCgURETEoFERExKBQEBERg0JBREQMCgURETEoFERExKBQEBERg0JBREQMCgURETEoFERExKBQEBERg0JBREQMCgURETEoFERExKBQEBERg0JBREQMCgURETEoFERExKBQEBERg0JBREQMCgURETEoFERExKBQEBERg0JBREQMCgURETEoFERExKBQEBERg0JBREQMCgURETEoFERExKBQEPmLZs6cycKFCxt8XlFREe7u7lRWVjboPIfDwbhx42jZsiWjRo1qcLuPYsuWLYSGhv4tbUnjcm7sDog0dxs2bHik8zp37kxFRUWDzyspKWHHjh2cP3+ewMDAR2pb5F60UhB5CJMmTWLevHlGubKyklatWpGfn098fDxz584FIDo6mvj4eNq3b8/w4cNxOBykpKTg7e1Np06dWLNmDc7OzhQWFlJYWIjJZKKiooLMzEwsFgtz5szB09OTj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voyb948li5dahw7e/YsHTp0oLi4mB49enDo0CEqKip47733ePnll7l58yZOTk6P4Y7lSdNKQeQhWSwW2rVrx/Lly++5dfS/4uPjWbt2LefOnaOysvKRHl29HycnJ+Li4liwYAHXr1+nsrKSxMRE4uPjG3ytmzdv0qpVK0wmE/n5+axcuZLq6up69aZOnUpaWhonT57E4XCwa9cugoKCKC4u5ujRo1itVgoKCnB3d8dsNtOmTRsFQjOiUBBpgClTpnDjxg1Gjhz5UPUnTZrExIkTCQsLo2fPnnTt2hUAV1fXx9and999Fy8vL/r06UPHjh25ceMGGRkZDb5Oamoqq1evpnXr1owZM4b4+HjKysq4evVqnXoDBgzgnXfeYfLkybRu3ZpFixaRkZFBjx49GDt2LNOmTSMqKgp3d3fS0tLYsWPH47pV+RuYHHcepxCRx+706dN4e3vj6+sL/PFkT1BQEBUVFbi5uTVy70Tq00pB5Anav38/r7zyCr/++itVVVWsXLmSgQMHKhCkyVIoiDxBs2fPpkuXLgQGBuLj48O1a9f48MMPG7tbIvek7SMRETFopSAiIgaFgoiIGBQKIiJiUCiIiIhBoSAiIob/Ag1DUlzdois1AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 360x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Initialize figure.\n",
    "n_conditions = ratio_frames_df['condition'].nunique()\n",
    "figure, axis = plt.subplots(figsize=(1.25*n_conditions, 4))\n",
    "\n",
    "# Draw the boxplot.\n",
    "sns.boxplot(x='condition',\n",
    "            y='ratio_frames',\n",
    "            data=ratio_frames_df,\n",
    "            order=list(experiments.keys()),\n",
    "            palette=['steelblue'],\n",
    "            width=0.6,\n",
    "            showfliers=False,\n",
    "            boxprops={'edgecolor': INK},\n",
    "            medianprops={'color': INK},\n",
    "            whiskerprops={'color': INK},\n",
    "            capprops={'color': INK}\n",
    "           )\n",
    "\n",
    "# Draw the swarmplot.\n",
    "sns.swarmplot(x='condition',\n",
    "              y='ratio_frames',\n",
    "              data=ratio_frames_df,\n",
    "              order=list(experiments.keys()),\n",
    "              palette=['steelblue'],\n",
    "              linewidth=0.75,\n",
    "              edgecolor=INK\n",
    "             )\n",
    "\n",
    "# Figure and axes formatting.\n",
    "axis.set_xlabel('virgin females', labelpad=100)\n",
    "axis.set_xticklabels([''])\n",
    "axis.set_ylabel('Aggression Rate (%)')\n",
    "axis.set_ylim(0, 0.2)\n",
    "axis.set_yticks(np.arange(0, 0.2+0.001, 0.05))\n",
    "axis.set_yticklabels([int(y*100) for y in axis.get_yticks()])\n",
    "\n",
    "# Table definition.\n",
    "row1 = [str(ratio_frames_df.query('condition==\"'+condition+'\"').shape[0]) for condition in list(experiments.keys())]\n",
    "row2 = ['+', '+', '-', '-']\n",
    "row3 = ['+', '-', '+', '-']\n",
    "cell_text = np.array([row1, row2, row3])\n",
    "\n",
    "row_labels = ['n =', 'Copulating male', 'Food odour']\n",
    "summary_table = axis.table(cellText= cell_text,\n",
    "                           cellLoc='center',\n",
    "                           rowLabels=row_labels,\n",
    "                           rowLoc='right',\n",
    "                           colLoc='center'\n",
    "                          )\n",
    "\n",
    "summary_table.auto_set_font_size(False)\n",
    "summary_table.set_fontsize(11)\n",
    "\n",
    "properties = summary_table.properties()\n",
    "table_cells = properties['children']\n",
    "table_cell_ids = properties['celld']\n",
    "for cell_id, cell in zip(table_cell_ids, table_cells):\n",
    "    cell.set_height(0.12)\n",
    "    cell.set_alpha(0)\n",
    "    cell_row = cell_id[0]\n",
    "    cell_col = cell_id[1]\n",
    "    if cell_row > 0 and cell_col > -1:\n",
    "        cell.set_fontsize(16)\n",
    "\n",
    "# Draw statistical result.\n",
    "for p, condition in enumerate(list(experiments.keys())[1:]):\n",
    "    sig_height = 6 if (corrected_frames_pvalues.get(condition, 'NaN') == 'NaN') or (corrected_frames_pvalues.get(condition, 'NaN') >= 0.05) else 2\n",
    "    helpers.plot_stattest_result(ax=axis,\n",
    "                                 x1=p+1,\n",
    "                                 x2=p+1,\n",
    "                                 p_value=corrected_frames_pvalues.get(condition, 'NaN'),\n",
    "                                 y=0.18,\n",
    "                                 ticksize=0,\n",
    "                                 xytext=(0,sig_height),\n",
    "                                 fontsize=13,\n",
    "                                 color=INK,\n",
    "                                 connector_color=INK\n",
    "                                )\n",
    "\n",
    "# Saving parameters.\n",
    "filename = 'aggression_rate_first_5mins_mating_pairs_females_combined'\n",
    "plt.savefig(os.path.join(savepath, filename))\n",
    "\n",
    "plt.show()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
